<!DOCTYPE html>
<html>
<head th:replace="admin/common/html/head :: head(~{::title},~{::link},~{::style})">
<title>tomcat首页</title>

<!-- 这儿引用单独的css link -->
<!-- Ladda for Bootstrap 3按钮加载进度插件 -->
<link rel="stylesheet">
<style type="text/css">
/**
*这里写单独的css样式
*/
</style>
</head>
<body>

<div class="btn-group hidden-xs" id="exampleTableEventsToolbar" role="group">
 	<button onclick="$.operate.add()" type="button" class="btn btn-primary">
         <span class="entypo-plus-squared"></span>新增
     </button>
    <button  type="button" class="btn btn-primary">
         <span class="entypo-plus-squared"></span><a style="color: white;" th:href="@{/admin/index}">返回</a>
     </button>
    
    
</div>

<table id="dataTable" class="table-striped footable-res footable metro-blue" data-page-size="6">
</table>



<!-- 通用js -->
<div th:include="admin/common/html/js :: onload_js">
</div>
<script type="text/javascript" th:inline="javascript">
var dataUrl=window.rootPath+"/TomcatConfigController/list";
var createUrl=window.rootPath+"/TomcatConfigController/add";
  var options = {
		dataUrl: dataUrl,
        createUrl: createUrl,
        sortName: "roleSort",
        modalName: "项目",
        search: false,
	    dataColumns: [
			{
			    checkbox: true
			}, 
			{
			    field: 'tomcatName',
			    title: '服务器名称'
			},
			{
			    field: 'tomcatAddress',
			    title: '实际地址'
			},
			{
			    field: 'tomcatUrl',
			    title: '访问地址'
			    
			},
			{
			    title: '操作',
			    formatter: function (value, row, index) {
			        var id = row.id;
			        var actions = [];
			       /* actions.push(' <a class="btn btn-success btn-xs"  href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');*/
			        actions.push(' <a class="btn btn-danger btn-xs" href="#" onclick="remove(\'' + row.tomcatName + '\')"><i class="fa fa-remove"></i>删除</a>');
			        actions.push(' <a class="btn btn-success btn-xs"  href="#" onclick="viewWar(\'' + row.tomcatName + '\')"><i class="fa fa-edit"></i>更新war</a> ');
			        actions.push(' <a class="btn btn-success btn-xs"  href="#" onclick="putManager(\'' + row.tomcatName + '\')"><i class="fa fa-edit"></i>部署magger项目</a> ');
			        return actions.join('');
			
			        //return '<a class="btn btn-xs btn-danger" onclick="delPermission(' + "'" + id + "'" + ')"><i class="fa fa-remove"></i>删除</a>';
			    }
			}]
  };
$(function(){
	var oTab=$.table.oTableInit(options);
	oTab.Init();
})


function viewWar(tomcatName){
    localStorage.setItem("tomcatName",tomcatName);
	var url="viewWar";
	$.modal.open("更新war", url);
}

function putManager(tomcatName){
    $.ajax({
        "url":window.rootPath+"/TomcatConfigController/putManager/"+tomcatName,
        "success":function(result){
            alert(result.msg);
        }
    });
}
function remove(tomcatName){
    $.ajax({
        "url":window.rootPath+"/TomcatConfigController/cancelTomcat/"+tomcatName,
        "success":function(result){
            alert(result.msg);
        }
    });
}

</script>


</body>
</html>